package com.xiguaji.tiktok.v1.ins.comment.repository;

import com.xiguaji.tiktok.v1.ins.comment.dto.InsActiveTime;
import com.xiguaji.tiktok.v1.ins.comment.model.InsComment;
import org.springframework.data.jdbc.repository.query.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

/**
 * 帖子dao
 * @author Huang xin
 */
public interface InsCommentRepository extends CrudRepository<InsComment,Long> {

    /**
     * 根据uid 获取活跃天
     * @param uid
     * @return
     */
    @Query("select week_day active_time,count(1) `count` from ins_comment where m_uid = :uid group by week_day order by week_day ")
    List<InsActiveTime> findActiveDayByUid(long uid);

    /**
     * 根据uid 获取活跃小时
     * @param uid
     * @return
     */
    @Query("select day_hours active_time,count(1) `count` from ins_comment where m_uid = :uid group by day_hours order by day_hours ")
    List<InsActiveTime> findActiveHourByUid(long uid);
}
